package com.atguigu.flyweight;

/**
 * @program: design-patterns
 * @author: yangshen
 * @description: 客户端
 * @create: 2022-02-23 16:07
 **/
public class Client {
    public static void main(String[] args) {
        //创建一个工厂类
        WebSitFactory factory = new WebSitFactory();
        //客户要一个一新闻形式发布的网站
        WebSit webSit1 = factory.getWebSitCategory("新闻");
        webSit1.use(new User("tom"));

        //客户要一个一博客形式发布的网站
        WebSit webSit2 = factory.getWebSitCategory("博客");
        webSit2.use(new User("jack"));

        //客户要一个一博客形式发布的网站
        WebSit webSit3 = factory.getWebSitCategory("博客");
        webSit3.use(new User("smith"));

        //客户要一个一博客形式发布的网站
        WebSit webSit4 = factory.getWebSitCategory("博客");
        webSit4.use(new User("king"));

        System.out.println("网站的分类共 = " + factory.getWebSitCount());
    }
}
